const { Schema, model } = require('mongoose');

//创建新闻分类

const newsClassSchema = new Schema({
    title: String,
    content: String,

}, {
    timestamps: true,
    versionKey: false,
})

//创建新闻内容
const newsSchema = new Schema({
    title: String,
    desc: String,
    fileId: String,
    classid: {
        type: Schema.Types.ObjectId,
        ref: 'newsClass'
    },

}, {
    timestamps: true,
    versionKey: false,
})

const newsClass = model('newsClass', newsClassSchema);
const news = model('news', newsSchema);

module.exports = { newsClass, news };

